home *** CD-ROM | disk | FTP | other *** search
- ;unsigned short number_fixed();
-
- EXTRN _memory_model:byte
-
- _TEXT SEGMENT BYTE PUBLIC 'CODE'
- ASSUME CS:_TEXT
- PUBLIC _number_fixed
- _number_fixed proc near
- push di ;
- push si ;
- push ds ;DS changed by interrupt
- int 11h ;make BIOS equipment chk
- sub si,si ;counts floppy drives
- test ax,1 ;any drives at all?
- jz L2 ;jump ahead if not
- and ax,11000000B ;clear all bits but 6-7
- mov cl,6 ;ready for shift
- shr ax,cl ;bits to bottom of AX
- inc ax ;count from 1, not 0
- cmp ax,2 ;at least two floppies?
- jae L1 ;jump if so
- mov ax,2 ;else skip over vacant specifier
- L1: mov si,ax ;copy in SI
- L2: sub di,di ;DI counts hard drives
- L3: inc si ;drive number
- mov dx,si ;place in DL for function
- mov ah,1ch ;disk type function
- int 21h ;get the type
- mov al,[bx] ;move type code to AL
- sub cl,cl ;clear CL
- mov [bx],cl ;remedy apparent DOS bug
- cmp al,0f8h ;a fixed disk?
- jne L4 ;jump ahead if not
- inc di ;else inc drive count
- jmp L3 ;check for another
- L4: mov ax,di ;set return value
- pop ds ;restore registers
- pop si ;
- pop di
- cmp _memory_model,0 ;quit
- jle Quit ;
- db 0CBh ;RET far
- Quit: ret ;RET near
- _number_fixed endp
- _TEXT ENDS
- END